package com.asset.modules.common.servcie;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

@Service
@Transactional(rollbackFor = Exception.class)
public class MailService {
    //HTTP port
//    @Value("${http.port}")
    private Integer httpsPort;

    @Value("${server.host}")
    private String host;

    public String generateVerifyUrl(String username,String verifyCode){
        String verifyUrl = "";
        verifyUrl += "https://"+host+":"+httpsPort+"/user/activate"+"?username="+username+"&verifyCode="+verifyCode;
        return  verifyUrl;
    }

    public String generateVerifyText(){
        String verifyText="";
        verifyText+="您好!\n";
        verifyText+="感谢您注册asset帐户。为激活您的帐户，请单击下列链接。\n";
        verifyText+="%s \n";
        verifyText+="如果单击链接没有反应，请将链接复制到浏览器窗口中，或直接输入链接。\n";
        verifyText+="致敬！\n";
        verifyText+="asset团队\n";
        return verifyText;
    }
}
